<?php
/**
 *
 *
 */
namespace Yz\modules\Uploads;
class Item_UploadImage
    extends Item_Upload
{


    /** get the HTML code for displaying
     *
     *  @return string|null
     */
    public function buildHTML(\Yz_Template_Interface $t)
    {
        debug();
        $filename = $this->filename;
        if (! $filename)
            return null;

        $m = $this->model;
        $fullPath = $m->getUploadPath();
        $webRoot = $t->webRoot;
        $filenameURL = rawurlencode($filename);
        $filenameHTML = \Yz_String::toHTML($filename);
        $html = <<<html
            <a href="{$webRoot}{$fullPath}{$filenameURL}" target="_blank" title="{$filenameHTML}"><img
                src="{$webRoot}{$fullPath}{$filenameURL}" alt="{$filenameHTML}" /></a>\n
html;
        return $html;
    }

} // class
